package me.zhengjie.util;

import org.springframework.stereotype.Component;

@Component
public class AnalyseCodeScannerUtil {

    public static String analyseCodeScanner(String firstCode, String secondCode) {
        String scannerValue;

        if(firstCode != null && secondCode != null) {

            firstCode = new StringBuffer(firstCode).reverse().toString();
            secondCode = new StringBuffer(secondCode).reverse().toString();
            scannerValue = firstCode.concat(secondCode).substring(0,3);
            try {
                Integer.parseInt(scannerValue);
            }
            catch (NumberFormatException e) {
                scannerValue = null;

            }
        }
        else{
            scannerValue = null;
        }
        return scannerValue;
    }
}
